<?php
session_start();
if (isset($_SESSION['openid'])){
    include_once("../c/config.php");
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
    $openid=$_SESSION['openid'];
    $jinfo=array();
    $query=$mysqli->query("select id,jid,thecode from ling where openid='".$openid."' order by jid ");
    while ($list=$query->fetch_array()){
        
        $isLing='qu';
        $jName='wu';
        if (4 == $list['jid']){
            $jName='yib';
        }
        if (1 == $list['jid']){
            $jName='xxj';
            $queryUinfo=$mysqli->query("select id from uinfo where openid='".$openid."' limit 0,1 ");
            if($queryUinfo->num_rows>0){
                $isLing='y';
            }else{
                $isLing='qu';
            }
        }
        if (!empty($list['thecode'])){
            $isLing='y';
        }
        $jinfo[]=array(
            'id'=>$list['id'], 'j'=>$jName,'l'=>$isLing
        );
    }
    echo json_encode($jinfo);
    
     
}
?>
